#ifndef __CF_WORKSPACE_MANAGER_H__
#define __CF_WORKSPACE_MANAGER_H__

#pragma once

#include "CL_Singleton.h"
#include "CE.h"
//#include "CF_SceneNode.h"

#include <QObject>
//#include <QVector>
#include <vector>

class CF_WorkspaceManager : public QObject
{
public:
	CF_WorkspaceManager();
	~CF_WorkspaceManager();

	void clear();

	bool createProject(const QString& name, const QString& path);
	const QString& getProjectName() const { return m_projName; }
	const QString& getProjectPath() const { return m_projPath; }
	QString makeWorkspaceFilePath();

	CE_Scene* createScene(const QString& sceneName, const QString& fileName = tr(""));
	CE_Scene* getScene(int index) { CF_ASSERT(isValidSceneIndex(index), "invalid scene index"); return m_scenes[index]; }
	CE_Scene* getSceneByName(const QString& sceneName);
	int getSceneCount() const { return (int)m_scenes.size(); }
	bool isValidSceneIndex(int index) const { return index>=0 && index<getSceneCount(); }

	bool load(const QString& filePath);
	bool save();
	bool isLoaded() const { return !m_projName.isEmpty(); }

protected:
	QString m_projName;
	QString m_projPath;

	std::vector<CE_Scene*> m_scenes;
};

#define workspaceManager (CL_Singleton<CF_WorkspaceManager>::instance())

#endif // __CF_WORKSPACE_MANAGER_H__